/---------------------------------------------------------------------------

void __fastcall TForm1::FormActivate(TObject *Sender)
{
SG1->Cells[1][0] = "A";
SG1->Cells[2][0] = "B";
SG1->Cells[3][0] = "C";
SG1->Cells[0][1] = "1";
SG1->Cells[0][2] = "2";
SG1->Cells[0][3] = "3";

}
//---------------------------------------------------------------------------

void __fastcall TForm1::SG1KeyUp(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
 if(SG1->Cells[1][1] == "123" && SG1->Cells[2][1] == "23" && SG1->Cells[3][1] == "3")
   {
    M1->Lines->Text = "   ";
   }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BBClick(TObject *Sender)
{
AnsiString a,b,c;
a = SG1->Cells[1][1];
b = SG1->Cells[2][1];
c = SG1->Cells[3][1];
if(a=="123" && b=="23" && c=="3")
  {
   SG1->Cells[4][1] = "6";
   M1->Lines->Text = "   ";
  }
}
//----------------